<script type="text/javascript">

$(function(){

	
	var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
			];
	
$( "#tags" ).autocomplete({
source: availableTags
});

$('#search_keywords').autocomplete({
    source: function(request, response) {
      $.ajax({
        url: 'http://localhost:8983/solr/terms?terms.fl=label_t',
        dataType: 'jsonp',
        data: {
          wt: 'json',
          'json.nl': 'arrarr',
          'terms.prefix': request.term,
          'terms.sort': 'index',
          'terms.limit': 5,
          omitHeader: 'true'
        },
        jsonp: 'json.wrf',
        success: function(data) {
          
          response($.map(data.terms.name, function(item) {
            return {
              label: item[0] + ' (' + item[1] + ')',
              value: item[1]
            
            };
          }));
          
          
        }
      })
    }
  });
	
});


</script>

<table id="search">
<tr>

<td id="centre" align="center">
	<img  src="/images/logo4.png"> 
	<div class="ui-widget">
	<div class="search">
	<form method="get" action="<?php echo url_for('download_search') ?>"> 
            <input type="text" id="search_keywords" value="" name="q"/>
            <div><input type="submit" value="submit" /></div>
    </form></div></div>
    <div class="help">
                  Entrer des mots clé( Titre, Categorie, Acteur, ......)
                </div>
    </td>
</tr>
</table>

<?php
if(count($results))
    echo "<div>Nous avons trouvé</div> ";
else
    echo "<div>Aucun résultat</div>";
foreach ($results as $fily){
  echo "<div>".$fily->getLabel()." ".$fily->getTrailer()."</div>";
}?>

<div class="demo">

<div class="ui-widget">
	<label for="tags">Tags: </label>
	<input id="tags">
</div>

salut

</div>
